<?php
require 'includes/db.php';
if(isset($_POST['submit'])){
	$content=$_POST['content'];
	mysql_query("UPDATE pages SET content='$content'")or die(mysql_error());
	header('location:pages.php?msg=SuccessFully Updated');
} 
require 'header.php';
$name=$_GET['name'];
$sql=mysql_query("select * from pages where name='$name'");
$data=mysql_fetch_array($sql);
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
	<form action="" method="post">
	<table class="table table-striped">
		<table>
			<thead>
				<th colspan="2">Edit Copntent For Page <?=$name?></th>
			</thead>
			<tbody>
				<tr>
					<td>Content</td>
					<td><textarea class="form-control" name="content"><?=$data['content']?></textarea></td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td align="right"><input type="submit" name="submit" value="Update" /></td>
				</tr>
			</tbody>
		</table>
	</table>
</form>
</div>